#include "Folder.h"
#include <QPainter>

Folder::Folder()
    : Meta()
{
}

Folder::Folder(uint32_t id)
    : Meta(id)
{
}

QSize Folder::sizeHint() const
{
    return QSize(100, 80);
}

void Folder::paint(QPaintDevice* pd, const QRect& rect) const
{
    QPainter painter(pd);

    QPixmap pix(":/LxMemo/icons/folder.png");
    painter.drawPixmap(rect.topLeft() + QPoint(10, 2), pix);

    painter.save();
    QFont font("Microsoft YaHei UI", 16);
    painter.setFont(font);
    painter.drawText(rect.topLeft() + QPoint(30 + pix.width(), 30), _name);
    font.setPointSize(8);
    QPen pen;
    pen.setColor(Qt::gray);
    painter.setPen(pen);
    painter.setFont(font);
    painter.drawText(rect.topLeft() + QPoint(30 + pix.width(), 60), _time);
    painter.restore();
}